package com.cj.config;

import com.cj.User;
import com.cj.controller.UserController;
import com.cj.dao.UserDao;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author cc
 * @date 2025-05-12 08:36
 **/

public class DemoJavaConfig02 {


    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(JavaConfig.class);


        User user = ctx.getBean(User.class);
        System.out.println("user = " + user);


        UserDao ud = ctx.getBean("ud", UserDao.class);
        UserController uc = ctx.getBean(UserController.class);
        System.out.println(uc.getUserService());
        ud.sayHello();
    }
}
